package com.czl.elm.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.czl.elm.dao.MenuMapper;
import com.czl.elm.domain.Menu;
import com.czl.elm.service.IMenuService;
import com.czl.elm.util.ActionResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author zuoleiChen
 * @since 2021-05-19
 */
@Service
public class MenuServiceImpl extends ServiceImpl<MenuMapper, Menu> implements IMenuService {

    @Autowired
    private MenuMapper menuMapper;

    /**
     * 查询大菜单栏下的子菜单
     * @param parentid
     * @param identity
     * @return
     */
    @Override
    public ActionResult selectMenu(Integer parentid,String identity) {
        List<Menu> arr=menuMapper.selectMenu(parentid,identity);
        if(arr==null){
            return ActionResult.error("获取失败或无此菜单");
        }
        return ActionResult.success("获取成功",arr);
    }
}
